plugins {
    id 'org.jetbrains.kotlin.js' version '1.3.71'
}

group 'org.example'
version '1.0-SNAPSHOT'

def kotlinVersion = "1.3.70"
def reactVersion = "16.13.0"
def suffix = "-pre.94-kotlin-"
def kotlinReactVersion = reactVersion + suffix + kotlinVersion
def kotlinReactRouterVersion = "4.3.1" + suffix + kotlinVersion
def kotlinReduxVersion = "4.0.0" + suffix + kotlinVersion
def kotlinReactReduxVersion = "5.0.7" + suffix + kotlinVersion

repositories {
    mavenCentral()
    jcenter()
    maven { url "https://kotlin.bintray.com/kotlin-js-wrappers" }
    maven { url "https://kotlin.bintray.com/kotlinx" }
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-js"
    implementation "org.jetbrains:kotlin-react:$kotlinReactVersion"
    implementation "org.jetbrains:kotlin-react-dom:$kotlinReactVersion"
    implementation "org.jetbrains:kotlin-react-router-dom:$kotlinReactRouterVersion"
    implementation "org.jetbrains:kotlin-redux:$kotlinReduxVersion"
    implementation "org.jetbrains:kotlin-react-redux:$kotlinReactReduxVersion"
    testImplementation "org.jetbrains.kotlin:kotlin-test-js"
}

kotlin {
    target.browser {}
    sourceSets["main"].dependencies {
        implementation(npm("react", "16.13.0"))
        implementation(npm("react-dom", "16.13.0"))
        implementation(npm("react-router-dom", "4.3.1"))
        implementation(npm("redux", "4.0.0"))
        implementation(npm("react-redux", "7.1.1"))
        implementation(npm("redux-logger", "3.0.6"))
    }
}

compileKotlinJs.kotlinOptions.moduleKind = 'commonjs'